package com.lzcu.maoyan.mapreduce.mapreduce.unit;

import org.apache.hadoop.mapreduce.lib.db.DBWritable;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author WangLiang
 * @date `2024/5/8`
 */
public class MovieMonthCountWritable implements DBWritable {
    private String movieType;
    private int count;
    private String sourceMovieType;
    private String movieName;
    private String sourceMovieName;
    private String releaseDate;
    private long maxTotal;
    private long sourceMaxTotal;
    private String timeData;

    @Override
    public void write(PreparedStatement statement) throws SQLException {
        statement.setString(1, this.timeData);
        statement.setLong(2, this.count);
        statement.setLong(3, this.maxTotal);
        statement.setString(4, this.movieName);
    }

    @Override
    public void readFields(ResultSet resultSet) throws SQLException {
        this.sourceMovieType = resultSet.getString("SOURCE_MOVIE_TYPE");
        this.sourceMovieName = resultSet.getString("MOVIE_NAME");
        this.sourceMaxTotal = resultSet.getLong("MAXTOTAL");
        this.releaseDate = resultSet.getString("RELEASEDATE");
    }

    public String getMovieType() {
        return movieType;
    }

    public void setMovieType(String movieType) {
        this.movieType = movieType;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public String getSourceMovieType() {
        return sourceMovieType;
    }

    public void setSourceMovieType(String sourceMovieType) {
        this.sourceMovieType = sourceMovieType;
    }

    public String getMovieName() {
        return movieName;
    }

    public void setMovieName(String movieName) {
        this.movieName = movieName;
    }

    public String getSourceMovieName() {
        return sourceMovieName;
    }

    public void setSourceMovieName(String sourceMovieName) {
        this.sourceMovieName = sourceMovieName;
    }

    public String getReleaseDate() {
        return releaseDate;
    }

    public void setReleaseDate(String releaseDate) {
        this.releaseDate = releaseDate;
    }

    public long getMaxTotal() {
        return maxTotal;
    }

    public void setMaxTotal(long maxTotal) {
        this.maxTotal = maxTotal;
    }

    public long getSourceMaxTotal() {
        return sourceMaxTotal;
    }

    public void setSourceMaxTotal(long sourceMaxTotal) {
        this.sourceMaxTotal = sourceMaxTotal;
    }

    public String getTimeData() {
        return timeData;
    }

    public void setTimeData(String timeData) {
        this.timeData = timeData;
    }

    @Override
    public String toString() {
        return "MovieMonthCountWritable{" +
                "movieType='" + movieType + '\'' +
                ", count=" + count +
                ", sourceMovieType='" + sourceMovieType + '\'' +
                ", movieName='" + movieName + '\'' +
                ", sourceMovieName='" + sourceMovieName + '\'' +
                ", releaseDate='" + releaseDate + '\'' +
                ", maxTotal=" + maxTotal +
                ", sourceMaxTotal=" + sourceMaxTotal +
                ", timeData='" + timeData + '\'' +
                '}';
    }
}
